﻿using DataScripter.Excel.Formatters;
using DataScripter.Excel.Formulas;

namespace DataScripter.Excel.FormattedValues
{
	class UnroundedPercent : BaseFormattedValue
	{
		private readonly decimal? _value;
		private readonly Formula _formula;

		public UnroundedPercent(decimal? value) : this()
		{
			_value = value / 100M;
		}

		public UnroundedPercent(Formula formula) : this()
		{
			_formula = formula;
		}

		private UnroundedPercent() : base(new UnroundedPercentFormatter())
		{}

		#region Implementation of IFormattedValue

		public override object Value
		{
			get { return _value ?? (object)_formula; }
		}

		#endregion
	}
}